package me.uniauto.service.impl;

import io.swagger.models.auth.In;
import me.uniauto.bean.MUserCode;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created by hardy on 2018/2/26.
 *
 * 缓存存放
 */
@Component
public class CacheServiceImpl {

    @CachePut(value = "user_code_info",key = "'user_code_info_'+#userCodeId")
    public MUserCode updateUserCode(Integer userCodeId,Map map){
        MUserCode userCodeVO = new MUserCode();
        userCodeVO.setUserId(Integer.parseInt(map.get("userId")+""));
        userCodeVO.setUserCode(map.get("userCode")+"");
        userCodeVO.setUserCodeId(Integer.parseInt(map.get("userCodeId")+""));
        return userCodeVO;
    }

    @Cacheable(value = "user_code_info",key = "'user_code_info_'+#userCodeId")
    public MUserCode selUserCodeInfo(Integer userCodeId){
        System.out.println("----selUserCodeInfo----");
        return null;
    }

}
